home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / arcer / gnutar10.lha / GnuTAR / GNUTarSource.LHA / source / rmt.h < prev    next >
C/C++ Source or Header  |  1991-07-04  |  3KB  |  88 lines

  1. /* Remote tape drive defines for tar.
  2.    Copyright (C) 1988 Free Software Foundation
  3.  
  4. This file is part of GNU Tar.
  5.  
  6. GNU Tar is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU Tar is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Tar; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifdef NO_REMOTE
  21. #define rmtopen     open
  22. #define rmtaccess    access
  23. #define rmtstat     stat
  24. #define rmtcreat    creat
  25. #define rmtlstat    lstat
  26. #define rmtread     read
  27. #define rmtwrite    write
  28. #define rmtlseek    lseek
  29. #define rmtclose    close
  30. #define rmtioctl    ioctl
  31. #define rmtdup        dup
  32. #define rmtfstat    fstat
  33. #define rmtfcntl    fcntl
  34. #define rmtisatty    isatty
  35.  
  36. #ifndef AMIGA
  37. extern long lseek();
  38. #endif
  39. #else
  40. #ifndef USG
  41. #define strchr index
  42. #endif
  43.  
  44. #define __REM_BIAS    128
  45. #define RMTIOCTL
  46.  
  47. #ifndef O_CREAT
  48. #define O_CREAT 01000
  49. #endif
  50. extern char *__rmt_path;
  51. extern char *strchr();
  52.  
  53. #define _remdev(path)   ((__rmt_path=strchr(path, ':')) && strncmp(__rmt_path, ":/dev/", 6)==0)
  54. #define _isrmt(fd)              ((fd) >= __REM_BIAS)
  55.  
  56. #define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
  57. #define rmtaccess(path, amode)  (_remdev(path) ? 0 : access(path, amode))
  58. #define rmtstat(path, buf)      (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
  59. #define rmtcreat(path, mode)    (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
  60. #define rmtlstat(path,buf)      (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
  61.  
  62. #define rmtread(fd, buf, n)     (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
  63. #define rmtwrite(fd, buf, n)    (_isrmt(fd) ? __rmt_write(fd - __REM_BIAS, buf, n) : write(fd, buf, n))
  64. #define rmtlseek(fd, off, wh)   (_isrmt(fd) ? __rmt_lseek(fd - __REM_BIAS, off, wh) : lseek(fd, off, wh))
  65. #define rmtclose(fd)            (_isrmt(fd) ? __rmt_close(fd - __REM_BIAS) : close(fd))
  66. #ifdef RMTIOCTL
  67. #define rmtioctl(fd,req,arg)    (_isrmt(fd) ? __rmt_ioctl(fd - __REM_BIAS, req, arg) : ioctl(fd, req, arg))
  68. #else
  69. #define rmtioctl(fd,req,arg)    (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : ioctl(fd, req, arg))
  70. #endif
  71. #define rmtdup(fd)              (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : dup(fd))
  72. #define rmtfstat(fd, buf)       (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fstat(fd, buf))
  73. #define rmtfcntl(fd,cmd,arg)    (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fcntl (fd, cmd, arg))
  74. #define rmtisatty(fd)           (_isrmt(fd) ? 0 : isatty(fd))
  75.  
  76. #undef RMTIOCTL
  77. #ifdef AMIGA
  78. extern long __rmt_lseek();
  79. #else
  80. extern long lseek(),__rmt_lseek();
  81. #endif
  82. #endif
  83.  
  84. #ifndef _isrmt
  85. #define _isrmt(fd)  0
  86. #endif
  87.  
  88.